package huawei;

import java.util.Scanner;

/**
 * 最长连续交替方波
 */
public class Q95 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();


        input = "0" + input + "0";
        int startIndex = -1;
        boolean has11 = false;
        String res = "";
        for (int i = 1; i < input.length(); i++) {
            if (input.charAt(i) == '0' && input.charAt(i - 1) == '0') {
                if (startIndex != -1 && startIndex != i - 1 && !has11 && res.length() < i - startIndex) {
                    res = input.substring(startIndex, i);
                }

                startIndex = i;
                has11 = false;
            } if (input.charAt(i) == '1' && input.charAt(i - 1) == '1') {
                has11 = true;
            }
        }

        if (res.isEmpty()) {
            System.out.println(-1);
        } else {
            System.out.println(res);
        }
    }
}
